//
//  ZBHTTPService+Login.m
//  BaseRACDemo
//
//  Created by 庄波 on 2018/3/27.
//  Copyright © 2018年 庄波. All rights reserved.
//

#import "ZBHTTPService+Login.h"
#import "ZBObject.h"
#import "ZBUserOwn.h"
@implementation ZBHTTPService (Login)
- (RACSignal *)getCodeWithPhone:(NSString *)phone{

    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"phone"] = phone;

    /// 2. 配置参数模型 #define MH_GET_LIVE_ROOM_LIST  @"Room/GetHotLive_v2"
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_GET path:MH_GET_Phone_Code parameters:subscript.dictionary];
    
    /// 3.发起请求
    return [[MHHTTPRequest requestWithParameters:paramters]
             enqueueResultClass:[ZBObject class]]
            ;
}

- (RACSignal *)loginWithPhone:(NSString *)phone withCode:(NSString *)code{
    
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"phone"] = phone;
    subscript[@"yzm"] = code;

    /// 2. 配置参数模型 #define MH_GET_LIVE_ROOM_LIST  @"Room/GetHotLive_v2"
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_GET path:MH_GET_Login parameters:subscript.dictionary];
    
    /// 3.发起请求
    return [[[MHHTTPRequest requestWithParameters:paramters]
             enqueueResultClass:[ZBUserOwn class]] mh_parsedResults];
}
@end
